﻿Imports System.Data.SqlClient
Imports System.Configuration
Public Class FmCapNhatKhachHang
    Dim Dt As New DataTable("KHACHHANG")

    Private Sub FmCapNhatKhachHang_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        XdKetNoi()
        Dim dieuphoi As New SqlDataAdapter("Select * from KHACHHANG", KetNoi)
        Dim DTKH As New DataTable
        dieuphoi.Fill(DTKH)
        KetNoi.Close()

        BindingSource1.DataSource = DTKH
        DgvKH.DataSource = BindingSource1
        TxtTenKH.DataBindings.Add("Text", BindingSource1, "TENKH")
        TxtDiaChi.DataBindings.Add("Text", BindingSource1, "DIACHI")
        TxtMST.DataBindings.Add("Text", BindingSource1, "MASOTHUE")
        TxtSDT.DataBindings.Add("Text", BindingSource1, "SDT")
        TxtSoTK.DataBindings.Add("Text", BindingSource1, "SOTK")


        CbMaKH.DataSource = DTKH
        'CbMAHANG.DisplayMember = "MAHANG"
        CbMaKH.ValueMember = "MAKH"
        CbMaKH.DataBindings.Add("SelectedValue", BindingSource1, "MAKH")

        KetNoi.Close()
    End Sub
    Dim ChuoiSoSanh As String = String.Empty

    Private Sub BtXem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtXem.Click
        XdKetNoi()
        Dim dieuphoi As New SqlDataAdapter("Select * from KHACHHANG", KetNoi)

        Dim DTKH As New DataTable
        dieuphoi.Fill(DTKH)
        KetNoi.Close()
        DgvKH.DataSource = DTKH

        DgvKH.Columns(0).HeaderText = "Mã Khách Hàng"
        'DgvHangHoa.Columns(2).Width = 250
        'DgvHangHoa.Columns(3).Width = 100
        'DgvHangHoa.Columns(4).Width = 60
        'DgvHangHoa.Columns(1).Width = 200
        DgvKH.Columns(1).HeaderText = "Tên Khách Hàng"
        DgvKH.Columns(2).HeaderText = "Địa Chỉ"
        DgvKH.Columns(3).HeaderText = "Số Điện Thoại"
        DgvKH.Columns(4).HeaderText = "Mã Số Thuế"
        DgvKH.Columns(5).HeaderText = "Số Tài Khoản"

        KetNoi.Close()

    End Sub

   
    Private Sub BtThemMoi_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtThemMoi.Click
        FmNewKH.Show()
    End Sub

    Private Sub BtThoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtThoat.Click
        Me.Close()
    End Sub

    Private Sub BtXoa_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BtXoa.Click

    End Sub
End Class